window.qq = window.qq || {};
qq.maps = qq.maps || {};
window.soso || (window.soso = qq);
soso.maps || (soso.maps = qq.maps);
(function() {
    function getScript(src) {
        var protocol = (window.location.protocol == "https:") ? "https://" : "http://";
        src = src && (src.indexOf("http://") === 0 || src.indexOf("https://") === 0) ? src : protocol + src;
        document.write('<' + 'script src="' + src + '"' + ' type="text/javascript"><' + '/script>');
    }
    qq.maps.__load = function(apiLoad) {
        delete qq.maps.__load;
        apiLoad([
            ["2.4.80", "", 0],
            ["open.map.qq.com/", "apifiles/2/4/80/mods/", "open.map.qq.com/apifiles/2/4/80/theme/", true],
            [1, 18, 34.519469, 104.461761, 4],
            [1511164272229, "pr.map.qq.com/pingd", "pr.map.qq.com/pingd"],
            ["apis.map.qq.com/jsapi", "apikey.map.qq.com/mkey/index.php/mkey/check", "sv.map.qq.com/xf", "sv.map.qq.com/boundinfo", "sv.map.qq.com/rarp", "apis.map.qq.com/api/proxy/search", "apis.map.qq.com/api/proxy/routes/", "confinfo.map.qq.com/confinfo"],
            [
            [null, ["rt0.map.gtimg.com/tile", "rt1.map.gtimg.com/tile", "rt2.map.gtimg.com/tile", "rt3.map.gtimg.com/tile"], "png", [256, 256], 3, 19, "114", true, false],
            [null, ["m0.map.gtimg.com/hwap", "m1.map.gtimg.com/hwap", "m2.map.gtimg.com/hwap", "m3.map.gtimg.com/hwap"], "png", [128, 128], 3, 18, "110", false, false],
            [null, ["p0.map.gtimg.com/sateTiles", "p1.map.gtimg.com/sateTiles", "p2.map.gtimg.com/sateTiles", "p3.map.gtimg.com/sateTiles"], "jpg", [256, 256], 1, 19, "101", false, false],
            [null, ["rt0.map.gtimg.com/tile", "rt1.map.gtimg.com/tile", "rt2.map.gtimg.com/tile", "rt3.map.gtimg.com/tile"], "png", [256, 256], 1, 19, "", false, false],
            [null, ["sv0.map.qq.com/hlrender/", "sv1.map.qq.com/hlrender/", "sv2.map.qq.com/hlrender/", "sv3.map.qq.com/hlrender/"], "png", [256, 256], 1, 19, "", false, false],
            [null, ["rtt2.map.qq.com/rtt/", "rtt2a.map.qq.com/rtt/", "rtt2b.map.qq.com/rtt/", "rtt2c.map.qq.com/rtt/"], "png", [256, 256], 1, 19, "", false, false], null, [
            ["rt0.map.gtimg.com/vector/", "rt1.map.gtimg.com/vector/", "rt2.map.gtimg.com/vector/", "rt3.map.gtimg.com/vector/"],
            [256, 256], 3, 18, "114", ["rt0.map.gtimg.com/icons/", "rt1.map.gtimg.com/icons/", "rt2.map.gtimg.com/icons/", "rt3.map.gtimg.com/icons/"]
            ], null
            ],
            ["s.map.qq.com/TPano/v1.1.2/TPano.js", "map.qq.com/", ""]
            ], loadScriptTime);
    };
    var loadScriptTime = (new Date).getTime();
    getScript("open.map.qq.com/apifiles/2/4/80/main.js");
})();

var geocoder,map,marker = null;
var init = function() {
    var center = new qq.maps.LatLng(23.1066805,113.3245904);
    map = new qq.maps.Map(document.getElementById('container'),{
      center: center,
      zoom: 15
  });
    //调用地址解析类
    geocoder = new qq.maps.Geocoder({
      complete : function(result){
        map.setCenter(result.detail.location);
        var marker = new qq.maps.Marker({
          map:map,
          position: result.detail.location
      });
    }
});
}

function codeAddress() {
    var address = document.getElementById("address").value;
      //通过getLocation();方法获取位置信息值
      geocoder.getLocation(address);
  }